package com.example.reactive.service;

import com.example.reactive.vo.UserVO;
import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.security.access.prepost.PreAuthorize;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

public interface RouterService {
    // 前置认证
    @PreAuthorize("hasRole('USER')")
    Mono<UserVO> readAccount(Long id);

    // 后置认证
    @PostAuthorize("hasRole('USER')")
    Flux<UserVO> findAccounts();

    // 前置认证，使用自定义认证处理规则
    @PreAuthorize("@func.apply(#userVO)")
    Mono<UserVO> post(UserVO userVO, Double amount);


}


// 参考 https://docs.springjava.cn/spring-security/reference/reactive/authorization/method.html